package com.net;

import org.junit.Test;

import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.UnknownHostException;
import java.util.Enumeration;

/**
 * 表示ip协议地址
 */
public class InetAddressDemo {

    @Test
    public void test01() throws UnknownHostException {
//        InetAddress localHost = InetAddress.getLocalHost();
//        System.out.println("本地主机： "+ localHost);
        InetAddress baiduIp = InetAddress.getByName("www.baidu.com");//发起请求通过dns解析到真实ip
        System.out.println("获取百度地址: "+baiduIp);
    }

}
